import FCollider, { ColliderType } from "./FCollider";

const { ccclass, property, menu } = cc._decorator;

@ccclass
@menu("碰撞组件Ex/FBoxCollider")
export default class FBoxCollider extends FCollider {
    public worldPoints: cc.Vec2[] = [cc.v2(), cc.v2(), cc.v2(), cc.v2()];
    public worldEdge: cc.Vec2[] = [];
    public isConvex: boolean = true;
    public get type() {
        return ColliderType.Box;
    }

    @property(cc.Size)
    private _size: cc.Size = cc.size(100, 100);

    @property
    public get size(): cc.Size {
        return this._size;
    }
    public set size(value: cc.Size) {
        this._size.width = value.width < 0 ? 0 : value.width;
        this._size.height = value.height < 0 ? 0 : value.height;
    }

}
